<style scoped src="./index.scss" lang="scss" rel="stylesheet/scss"></style>
<template src="./index.html"></template>
<script>

export default {
  mixins: [
    Vue.prototype.$vFN.Mixins.Table,
    Vue.prototype.$vFN.Utils,
    Vue.prototype.$vFN.Tools,
  ],
  components: {},
  data() {
    return {
      appWindow: window,
      value: "",

      // 页面接口地址
      apiUrl: { 
        list: "mall-site-portal/wechat-ma-tester/list",
        addLabel: "mall-site-portal/wechat-ma-tester/bindTester",
        relieve: "mall-site-portal/wechat-ma-tester/unbindTester",
      },
    };
  },
  methods: {
    // 初始化
    init() {
        // 刷新表格数据，此方法扩展时可重写
        this.mixinTable_refreshData();
    },

    // 添加微信号
   async addExperiencer(){

    if( this.$vFN.Utils.isEmpty(this.value)){
     this.$vFN.Tools.messageError("微信号不能为空")
      return false;
    }

    this.mixinTable_loading = true;

    let _data = await this.$vFN.Tools.getSelectListSource(
        {
          url: this.apiUrl.addLabel,
          data:{
            wechatId: this.value,
          }
        },
        window
      );

      if(_data._ok){
        // 刷新表格数据，此方法扩展时可重写
        this.mixinTable_refreshData();
      }
      this.mixinTable_loading = false;
    },

   // 解除绑定
   async relieveBind(value){
       this.mixinTable_loading = true;
       
       let _data = await this.$vFN.Tools.getSelectListSource(
        {
          url: this.apiUrl.relieve,
          data:{
            userstr: value
          }
        },
        window
      );
      
      if(_data._ok){
        // 刷新表格数据，此方法扩展时可重写
        this.mixinTable_refreshData();
      }

       this.mixinTable_loading = false;
    }

  },
  mounted() {
    this.init();
  },
  activated() {
  },
};
</script>